<%@page import="com.gadglet.params.*,javax.jdo.PersistenceManager,com.google.appengine.api.users.*,com.gadglet.data.utils.PMF,com.gadglet.data.*,com.gadglet.util.*,com.gadglet.data.Gadget,com.gadglet.util.UrlUtils,java.util.*,javax.jdo.Query,java.util.logging.Logger,com.gadglet.data.DomainUserUtils,com.gadglet.data.DomainUser,com.gadglet.data.DomainAccountUtils,com.gadglet.data.DomainAccount"%>
<%

ServletContext contextForProvider = null; 
String gadgetsHelpSite =  null;
String gadgetHelpUrl = null;
try
	{
	contextForProvider  = getServletContext();
	gadgetsHelpSite = contextForProvider.getInitParameter(SharedConstants.ctxParamGadgetsHelpSite);
	}
catch (Exception e){
		
	}

if(request.getParameter("gadget")!=null){
	
	PersistenceManager pm = PMF.get().getPersistenceManager();
	Query query = pm.newQuery(Gadget.class);
	query.setFilter("name == nameParam");
	query.declareParameters("String nameParam");
	query.setUnique(true); 

	try 
    {
	Gadget g  = (Gadget) query.execute(request.getParameter("gadget"));
	if(g!=null)
		gadgetHelpUrl  = g.getHelpUrl();
    }
	catch (Exception e)
	{
		
	}
	finally{
		pm.close();
	}
	

	if(gadgetHelpUrl!=null)
		response.sendRedirect(gadgetHelpUrl);
	else if(gadgetsHelpSite!=null)
		response.sendRedirect(gadgetsHelpSite);
	else
		out.println("under construction....");
	
}

%>
<%@include file="/include/footer.jsp" %>